/**
 * 
 */
package com.qb.mobile.core;

import android.app.Dialog;
import android.content.Context;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.qb.mobile.R;
import com.qb.mobile.core.actionbar.AbstractAction;

import android.view.View;
import android.view.View.OnClickListener;

/**
 * @author <a href="mailto:dangcongthanhtrung@gmail.com">dangtrung</a>
 * 
 *         AboutAction.java class
 * 
 */
public class AboutAction extends AbstractAction {

	public AboutAction() {
		super(R.drawable.ic_info_default);
	}

	@Override
	public void performAction(View view) {

		final Context context = view.getContext();

		// set up dialog
		final Dialog dialog = new Dialog(context);
		dialog.setContentView(R.layout.action_about_dialog);
		dialog.setTitle("About RSS");
		dialog.setCancelable(true);
		// there are a lot of settings, for dialog, check them all out!

		// set up text
		TextView text = (TextView) dialog.findViewById(R.id.txtContent);
		text.setText(R.string.about_content);

		// set up image view
		ImageView img = (ImageView) dialog.findViewById(R.id.ImageView01);
		img.setImageResource(R.drawable.android);

		// set up button
		Button button = (Button) dialog.findViewById(R.id.btnCancel);
		button.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				dialog.cancel();
			}
		});
		// now that the dialog is set up, it's time to show it
		dialog.show();
	}
}